package 算法.leetcode;

/**
 * @author:谢君臣
 * @Date:2021/5/19-16:11
 * @version:1.0
 * @function:
 */
public class lc477 {
    public static void main(String[] args) {

    }
    public int totalHammingDistance(int[] nums) {
        int count = 0;
        for(int i= 0;i<32;i++){
            int total = 0;
            for(int j =0;j<nums.length;j++){
                if((nums[j]>>i&1)==1) total++;
            }
            count +=total*(nums.length-total);
        }
        return count;
    }
}
